Imports System.Collections.Generic

Imports System.Web

#Region "using"
Imports System.Data
Imports QUANLY.DAO
Imports QUANLY.DTO
#End Region
Public Class NHANVIENBUS
	Private objDAO As NHANVIENDAO
	Public Sub New(strPath As [String])
		objDAO = New NHANVIENDAO(strPath)
	End Sub

	Public Function SelectAll() As DataSet
		Dim ds As DataSet
		Try
			ds = objDAO.SelectAll()
			Return ds
		Catch e As System.Exception
			Throw New Exception(e.Message, e.InnerException)
		End Try
	End Function

	Public Function SelectByID(id As Integer) As DataSet
		Dim ds As DataSet
		Try
			ds = objDAO.SelectByID(id)
			Return ds
		Catch e As System.Exception
			Throw New Exception(e.Message, e.InnerException)
		End Try
	End Function

    Public Function Search(ByVal id As String, ByVal name As String) As DataSet
        Dim ds As DataSet
        Try
            ds = objDAO.Search(id, name)
            Return ds
        Catch e As System.Exception
            Throw New Exception(e.Message, e.InnerException)
        End Try
    End Function

	Public Function Insert(obj As NHANVIENDTO) As Boolean
		Try
			Return objDAO.Insert(obj)
		Catch
			Return False
		End Try
	End Function

	Public Function Delete(id As Integer) As Boolean
		Try
			Return objDAO.Delete(id)
		Catch
			Return False
		End Try
	End Function

	Public Function Update(obj As NHANVIENDTO) As Boolean
		Try
			Return objDAO.Update(obj)
		Catch
			Return False
		End Try
	End Function

	Public Function SelectByIDLoaiNguoiDung(idloainguoidung As Integer) As DataSet
		Dim ds As DataSet
		Try
			ds = objDAO.SelectByIDLoaiNguoiDung(idloainguoidung)
			Return ds
		Catch e As System.Exception
			Throw New Exception(e.Message, e.InnerException)
		End Try
	End Function

	Public Function SelectByIDCV(idcv As Integer) As DataSet
		Dim ds As DataSet
		Try
			ds = objDAO.SelectByIDCV(idcv)
			Return ds
		Catch e As System.Exception
			Throw New Exception(e.Message, e.InnerException)
		End Try
	End Function

    Public Function SelectByUserName(ByVal username As String) As DataSet
        Dim ds As DataSet
        Try
            ds = objDAO.SelectByUserName(username)
            Return ds
        Catch e As System.Exception
            Throw New Exception(e.Message, e.InnerException)
        End Try
    End Function

    Public Function SelectByUserNameAndPassword(ByVal username As String, ByVal password As String) As DataSet
        Dim ds As DataSet
        Try
            ds = objDAO.SelectByUserNameAndPassword(username, password)
            Return ds
        Catch e As System.Exception
            Throw New Exception(e.Message, e.InnerException)
        End Try
    End Function
End Class
